

local cjson = require"cjson"

local io_popen     = io.popen
local arg_filename = ngx.var.arg_filename
local db_data      = {}

local file = io.open("/image_root/" .. arg_filename,"r")
if not file then
  local file2 = io.open("/data/logs/" .. arg_filename,"r")
  if not file2 then
    db_data.code =999
    db_data.content = "no file"
    return ngx.say(cjson.encode(db_data))
  end
  io_popen("rm -rf /data/logs/" .. arg_filename)
  db_data.code = 900
  db_data.content = "ok"
  return ngx.say(cjson.encode(db_data))
end
io_popen("rm -rf /image_root/" .. arg_filename)

db_data.code = 900
db_data.content = "ok"
ngx.say(cjson.encode(db_data))